package day20171001;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
        Document d=  Jsoup.connect("https://www.tripadvisor.com/Airlines").get();
        Elements m= d.select("div.balance").select("div[class=reviews]");
        int j=m.size();
        for (int i=0;i<j;i++){
            String path="/home/automan/dev/Test.txt";
            FileWriter fw=null;
            try {
                fw=new FileWriter(path,true);
                fw.write(m.get(i).text());
                fw.flush();
            }catch (IOException e){
                e.printStackTrace();
            }finally {
                if (fw!=null){
                    try {
                        fw.close();
                    }catch (IOException e){
                        e.printStackTrace();
                    }
                }
            }



            }
        }
    }